<template>
  <div>
    <el-tag>跟进记录</el-tag>
    <div v-for="item in dataList" style="font-size: 15px">
      <el-row>
        <el-col :span="8">
          <span>操作人员</span>
        </el-col>
        <el-col :span="16"><span>{{item.operName}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <span>操作时间</span>
        </el-col>
        <!--        时间戳-->
        <el-col :span="16"><span>{{parseTime(new Date(item.operTime),'{y}-{m}-{d}:{h}:{i}:{s}')}}</span></el-col>
      </el-row>
      <el-row v-if="item.record">
        <el-col :span="8">
          <span>操作详情</span>
        </el-col>
        <el-col :span="16"><span>{{item.record}}</span></el-col>
      </el-row>
      <el-row v-if="item.reason">
        <el-col :span="8">
          <span>伪线索原因</span>
        </el-col>
        <el-col :span="16">
          <span>{{selectDictLabel(dict.type.reasons_for_reporting, item.reason)}}</span>
        </el-col>
      </el-row>
      <el-row v-if="item.remark">
        <el-col :span="8">
          <span>伪线索详情</span>
        </el-col>
        <el-col :span="16"><span>{{item.remark}}</span></el-col>
      </el-row>
      <hr/>
    </div>
  </div>
</template>

<script>
  import {list} from "@/api/monitor/operlog";
  import {listTrackLog} from "../../../../api/crm/trackLog";

  export default {
    name: "track-list",
    dicts: ['reasons_for_reporting'],
    props: ['id'],
    data() {
      return {
        dataList: [],
        search: '线索',
      }
    },
    created() {
      this.getList();
    },
    methods: {
      // 查询线索跟踪记录
      getList() {
        // list({title: '线索跟踪记录'}).then(resp => {
        //   this.dataList = this.parseData(resp.rows);
        // });
        listTrackLog({id: this.id, table: this.search}).then(resp => {
          this.dataList = resp.rows;
        })
      },
      // 初始化
      parseData(result) {
        let list = [];
        if (result && result.length > 0) {
          for (let item of result) {
            let operParam = JSON.parse(item.operParam);
            if (operParam.id == this.id) {
              item.operParam = operParam;
              list.push(item);
            }
          }
        }
        return list;
      }
    },
  }
</script>

<style scoped>

</style>
